from decimal import Decimal
from dataclasses import dataclass
from datetime import date, datetime
from sqlormx import Model


@dataclass
class BaseModel(Model):
    {% for item in base_columns %}{% if item.DATA_TYPE=='None' %}{{item.COLUMN_NAME}}=None{% else %}{{item.COLUMN_NAME}}: {{item.DATA_TYPE}} = None{% endif %}
    {% endfor %})

{% for meta in metas %}
class {{meta.class_name}}(BaseModel):{% if meta.key != __key__ %}
    {{__attribute_name__key__}} = '{{meta.key}}'{% endif %}
    {{__attribute_name__table__}} = '{{meta.table}}'{% if meta.key_seq is not none %}
    {{__attribute_name__key_seq__}} = '{{meta.key_seq}}' {% endif %}
    {% for item in meta.self_columns %}{% if item.DATA_TYPE=='None' %}{{item.COLUMN_NAME}}=None{% else %}{{item.COLUMN_NAME}}: {{item.DATA_TYPE}} = None{% endif %}
    {% endfor %}

{% endfor %}